package com.uidp.domain;

import com.acsior.dac.exeption.DataAccessException;
import com.acsior.sbc.exception.BusinessException;
import com.acsior.sbc.exception.ValidationException;
import com.acsior.sbc.impl.hibernate.HibernateBusinessObject;
import com.uidp.hibernatelayer.AttributeDataDAO;
import com.uidp.hibernatelayer.AttributeDataVO;

public class AttributeData extends
		HibernateBusinessObject<AttributeDataVO, AttributeDataDAO> {

	private Modul modul;
	private Attributes attributes;
	private String attributeValue;

	public AttributeData() throws BusinessException {
		super();
	}

	public AttributeData(AttributeDataVO h) throws BusinessException {
		super(h);
	}

	/** @see PersistentObject#initialize() */
	@Override
	protected void initialize() throws BusinessException {
		super.initialize();
		setAttributeValue("");
		setAttributes(new Attributes());
		setModul(new Modul());
	}

	@Override
	protected void setValues(AttributeDataVO h) throws DataAccessException {
		h.setAttributeValue(getAttributeValue());
		h.setAttributes(getAttributes().findData());
		h.setModul(getModul().findData());

	}

	@Override
	protected void copyProperties(AttributeDataVO d, boolean deepCopy)
			throws BusinessException {
		setAttributeValue(d.getAttributeValue());
		setModul(new Modul(d.getModul()));
		setAttributes(new Attributes(d.getAttributes()));

	}

	@Override
	protected void validate() throws ValidationException {
		// TODO Auto-generated method stub

	}

	@Override
	protected Class<AttributeDataDAO> getDAOClass() {
		return AttributeDataDAO.class;
	}

	public Modul getModul() {
		return modul;
	}

	public void setModul(Modul modul) {
		this.modul = modul;
	}

	public Attributes getAttributes() {
		return attributes;
	}

	public void setAttributes(Attributes attributes) {
		this.attributes = attributes;
	}

	public String getAttributeValue() {
		return attributeValue;
	}

	public void setAttributeValue(String attributeValue) {
		this.attributeValue = attributeValue;
	}

}
